package com.pai4j.common.enums;

import lombok.Getter;

@Getter
public enum RoleCodeEnum {
    
    AIBOT(0, "我的Ai助手"),

    USER(1, "普通用户"),

    ADMIN(2, "管理员"),
    
    GUEST(3, "游客"),

    BLACK(4, "黑名单"),

    GROUP(5, "群组"),

    ROBOT(6, "聊天机器人"),

    SUBJECT_ACCOUNT(7, "专题号"),

    SERVER_ACCOUNT(8, "服务号"),
    ;

    private Integer code;
    private String name;

    RoleCodeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }
    
    /**
     * 判断是否为用户角色
     *
     * @author: CYM-pai
     * @date: 2025/04/01 21:48
     **/
    public static boolean isUserRole(Integer roleCode) {
        if (roleCode == null) {
            return false;
        }
        return USER.code.equals(roleCode) || ADMIN.code.equals(roleCode);
    }
    
    /**
     * 判断是否为ai助手角色
     *
     * @author: CYM-pai
     * @date: 2025/04/01 21:48
     **/
    public static boolean isAiBbotRole(Integer roleCode) {
        if (roleCode == null) {
            return false;
        }
        return AIBOT.code.equals(roleCode);
    }
    
    /**
     * 判断是否为用户可添加的角色
     *
     * @author: CYM-pai
     * @date: 2025/04/01 21:48
     **/
    public static boolean isAddRole(Integer roleCode) {
        if (roleCode == null) {
            return false;
        }
        return USER.code.equals(roleCode) || ADMIN.code.equals(roleCode) || AIBOT.code.equals(roleCode);
    }
    
}
